package com.woniuxy.homeWork.control;


import com.woniuxy.homeWork.commons.JDKProxy;
import com.woniuxy.homeWork.model.User;
import com.woniuxy.homeWork.service.UserService;
import com.woniuxy.homeWork.service.impl.UserServiceImpl;

import java.util.List;

/**
 * ClassName:Test
 * Package:control
 *
 * @date:2021/11/2 4:15 下午
 * @author: Tiangle
 */
public class Test {
    public static void main(String[] args) {
        UserService proxy = new JDKProxy<UserService>().getProxy(new UserServiceImpl());
        proxy.addUser(new User(4, "范腾龙", "123"));
        show();
        proxy.deleteUser(2);
        show();
        User one = proxy.getOne(1);
        one.setName("神奇的大树");
        proxy.updateUser(one);
        show();
    }
    static void show(){
        UserService proxy = new JDKProxy<UserService>().getProxy(new UserServiceImpl());
        List<User> all = proxy.getAll();
        System.out.println("show:");
        for (User user : all) {
            System.out.println(user);
        }
    }
}
